package com.loyal.loyalerp.humenresource.kaoqinMonth.mapper.provider;

import com.loyal.loyalerp.humenresource.kaoqinMonth.model.RsKaoqinmonth;

public class KaoqinMonthProvider {
	
	public String findKm(String searchField, String searchString){
		return "select * from rs_kaoqinmonth where "+searchField+" like CONCAT(CONCAT(\'%\',\'"+searchString+"\',\'%\'))";
	}

	public String listKaoqinMonth(String sidx,String sord) {
		return "select * from rs_kaoqinmonth order by "+sidx+" "+sord;
	}
	
	public String insertKaoqinMonth(RsKaoqinmonth record) {
		return "insert into rs_kaoqinmonth (comopanyId, year, month, mCloseFlag) values ("+record.getComopanyid()+","+ record.getYear()+","+record.getMonth()+","+record.getMcloseflag()+")";
	}
	
	public String selectByCY(RsKaoqinmonth record) {
		//注意用select count(*) 而不能用 select *  
		return "select count(*) from rs_kaoqinmonth where comopanyId = " + record.getComopanyid() + " and year = " + record.getYear();
	}
	
	public String getKmByYMC(RsKaoqinmonth record) {
		return "select * from rs_kaoqinmonth where comopanyId = " + record.getComopanyid() + " and year = " + record.getYear() + " and month = " + record.getMonth();
	}
	
	public String updateCloseFlag(int id,int closeFlag) {
		return "update rs_kaoqinmonth set mCloseFlag="+closeFlag+" where id="+id;
	}
	
	public String getKmByCY(int companyId,int year) {
		return "select * from rs_kaoqinmonth where comopanyId = " + companyId + " and year = " + year;
	}
}
